package com.bootdo.system.service.impl;

import com.bootdo.system.dao.SetDao;
import com.bootdo.system.domain.SetDO;
import com.bootdo.system.service.SetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Transient;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SetServiceImpl implements SetService {

    @Autowired
    private SetDao setDaoMapper;



    @Override
    public List<SetDO> list(String setCode) {
        return setDaoMapper.list(setCode);
    }
    @Override
    public SetDO get(String setCode){
        return setDaoMapper.get(setCode);
    }

    @Override
    public int update(SetDO setDO){
        return setDaoMapper.update(setDO);
    }

    @Override
    @Transient
    public int updatePort(String ip,String port){
        SetDO setDOip=new SetDO();
        setDOip.setSetCode("ip");
        setDOip.setSetValue(ip);
        setDaoMapper.update(setDOip);
        SetDO setDOport=new SetDO();
        setDOport.setSetCode("port");
        setDOport.setSetValue(port);
        setDaoMapper.update(setDOport);
        return 1;
    }

    @Override
    public int save(SetDO setDO){
        return setDaoMapper.save(setDO);
    }

    @Override
    public int remove(Long id){
        return setDaoMapper.remove(id);
    }

}
